home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / BPS210.ZIP / TUTOR.ASC < prev    next >
Text File  |  1991-07-25  |  26KB  |  638 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12. Back Error Propagation Simulator (BPS)
  13. Brief Tutorial
  14.  
  15. by
  16.  
  17. Emilio A. Apey
  18.  
  19.  
  20. Copyright George Mason University
  21. September 1989
  22.  
  23.  
  24.  
  25. Table of contents
  26.  
  27.         1.    Introduction .........................................................................    3
  28.         2.    Walk-through an example ..............................................    3
  29.             Figure 1  ................................................................................    4
  30.             Figure 2  ................................................................................    5
  31.             3.    Main menu .............................................................................    7
  32.                 3.1    Build/load network ...............................................    8
  33.                 3.2    Specify training set .............................................    10
  34.                 3.3    Edit and view menu  .............................................    10
  35.                 3.4    Save network ...........................................................    12
  36.                 3.5    Find error ..................................................................    12
  37.                 3.6    Number of epochs ..................................................    12
  38.                 3.7    Cycle until converges  .........................................    13
  39.                 3.8    Adjust learning parameters  ............................    13
  40.                 3.9    Production menu ...................................................    14
  41.                 3.10    Learn  ..........................................................................    15
  42.                 3.11    Transfer function options menu  ....................    16
  43.             4.    Formulas  ..............................................................................    17
  44.  
  45. 1)  Introduction
  46.  
  47.     The BPS program simulates a multilayer neural network using  back 
  48. error propagation as learning algorithm.  This simulator is intended for 
  49. educational purposes and depends heavily on user interaction.  It is 
  50. important for the user to be familiar with the back error propagation 
  51. algorithm before using BPS; in this way, the user can understand what 
  52. the simulator is doing.
  53.     In this brief "tutorial" most of the features of BPS will be 
  54. demonstrated by building a simple example.  Figure 1, overview of BPS, 
  55. can be very useful in becoming familiar with BPS.
  56.     Also, it is highly recommended for the user to draw the topology of 
  57. the network before using the simulator, indicating the layers numbers 
  58. and the unit numbers.  This will be helpful when the program asks for 
  59. information about layers and units.  To have an idea of a network 
  60. topology built by BPS, see  figure 2.
  61.  
  62.  
  63.  
  64. 2)  Walk-through an example
  65.  
  66.  
  67.     A simple example is to teach a network the XOR (exclusive OR) 
  68. mapping, which is the following:
  69.  
  70.  
  71.         input    output
  72.         -----    ------
  73.             0 0        0
  74.             0 1        1
  75.             1 0        1
  76.             1 1        0
  77.  
  78.  
  79.     For this example there are four "training patterns," one for each 
  80. mapping that the network has to learn.  Each training pattern consist of 
  81. an "input vector" and an "output vector."
  82.     The first thing to do, before entering BPS, is to write a "training set 
  83. file" and a "productions file" using an editor.  The format of the training 
  84. set file is very flexible; the restrictions are that an input vector has to 
  85. precede its corresponding output vector, there must be at least one 
  86. blank character separating each number, and there can be no blank lines. 
  87.  
  88.                                                                      
  89.  
  90. Figure 1:  overview of BPS
  91.  
  92.           
  93.                                                               
  94.  
  95. Now, for BPS to give meaningful results the user has to be careful that 
  96. the dimension of the input vectors matches the number of units in the 
  97. input layer of the network, and that the dimension of the output vectors 
  98. matches the number of units in the output layer.  If they do not match, 
  99. BPS will seem to be working normally, but the results will be 
  100. meaningless.  Here are three training set file formats that could be 
  101. used in this example:
  102.  
  103.  
  104.         0.0  0.0   0.1    0.0  0.0    0.0
  105.         0.0  1.0   0.9    0.1       0.0
  106.         1.0  0.0   0.9    0.0  1.0          0.1
  107.         1.0  1.0   0.1    0.9    0.0
  108.             1.0  0.0       1.0
  109.             0.9          0.9
  110.             1.0  1.0    1.0
  111.             0.1       0.0
  112.                       0.9
  113.                 1.0
  114.                    1.0
  115.                       0.1
  116.  
  117.         Format 1    Format 2    Format 3
  118.  
  119.  
  120.     The productions file is similar to the training set file, but the 
  121. output vectors are omitted; the network has to produce them.  As with 
  122. the training set file, the format is flexible, but there can be no blank 
  123. lines.
  124.  
  125.  
  126.         0.0  0.0    0.0    0.0
  127.         0.0  1.0    0.0      0.0
  128.         1.0  0.0    0.0    0.0
  129.         1.0  1.0    1.0      1.0
  130.             1.0    1.0
  131.             0.0       0.0
  132.             1.0    1.0
  133.             1.0      1.0
  134.  
  135.         Format 1    Format 2    Format 3
  136.     
  137.  
  138.     For the XOR example the training set file will be named XOR.DAT and 
  139. the productions file will be name XOR.PRO.
  140.     From the training patterns it can be seen that the network needs to 
  141. have two input units (the dimension of an input vector) and one output 
  142. unit (the dimension of an output vector).  The number of hidden layers 
  143. and hidden units is up to the user; it is good practice to keep networks 
  144. as small as possible because it takes less time to train them, since 
  145. there are fewer weights to update.  However, if they are too small they 
  146. might not be able to learn all the training patterns; this is one of the 
  147. artistic aspects of neural networks.  The simplest topology that can 
  148. learn the XOR mapping is the following:
  149.  
  150.  
  151.            
  152.  
  153. Figure 3:  XOR network topology
  154.  
  155.     Now it is time to get the program running and start doing something 
  156. with this network.  To run the program in the VAX 8530  type BPS.  If 
  157. you have the PC version, select the executable version that best fit 
  158. your computer (bps286.exe, bps8088.exe) and type the name without the 
  159. extension.
  160.  
  161. gmuvax> bps
  162.  
  163.     Once the initial message appears, hit return to enter the main menu.
  164.  
  165.  
  166. 3)  Main menu
  167.  
  168.     In this menu is where the user spends most time, here networks are 
  169. defined and then they are trained.  Under this menu there are three 
  170. other menus:  the production menu, the edit and view menu, and the 
  171. transfer function menu; they will be described later on.
  172.  
  173. 3.1)  Build/load network (b)
  174.  
  175.     The first thing to do when using BPS is to define a network, because 
  176. many functions depend on the network topology.  To define a network 
  177. choose "b" (for build) and answer the questions.  Remember to hit the 
  178. return key after each entry.
  179.     Supposed that you have been training a network for a while and then 
  180. decide to create or load a new network.  BPS will ask if you want to 
  181. save the old network.  Then, BPS will ask if you want to load a network 
  182. from your working directory:
  183.  
  184. Do you want to load a network from file? (y/n):  n 
  185.  
  186.     To load a network answer "y"; then BPS will ask you for the name of 
  187. a previously defined network.  The network is loaded and BPS returns to 
  188. the main menu.
  189.     In the case that you want to define a new network, then answer "n".  
  190. Next BPS will ask if you want to initialize the network with random 
  191. weights.
  192.  
  193. Do you want random weights? (y/n):  y
  194.  
  195.     When the answer is "y", BPS will completely connect all the units of 
  196. adjacent layers and the initial weights of the edges will be in the range 
  197. that you will soon specify.  When the answer is "n", BPS will not 
  198. connect any unit in the network at all; it will create the layers and 
  199. units, but there will not be any edges.  To connect the units you would 
  200. go to the Edit and View menu and add edges between the units that you 
  201. want to be connected.  So, at this point, BPS would create only a 
  202. skeleton of the network.
  203.     In the XOR example two edges will be added later on, an edge going 
  204. from the first unit in the first layer to the first unit in the third layer, 
  205. and an edge going from the second unit in the first layer to the first 
  206. unit in the third layer (see fig. 3).  But the rest of the network is fully 
  207. connected, so at this point answer "y", you do want edges with random 
  208. weights between the layers.
  209.     Then BPS will ask you for the lower and upper limit of the random 
  210. weights.  A good range is -0.34 and 0.34, that is -1/3 and +1/3.
  211.  
  212. Give lower limit of random interval:  -0.34
  213. Give upper limit of random interval:  0.34
  214.  
  215.     To initialize the weights with numbers close to zero is good 
  216. practice because if the weights are large it is very difficult, 
  217. sometimes impossible, for BPS to change those weights.
  218.     Next, BPS will ask you how many layers of units you want.  A typical 
  219. back propagation network has three layers, but if you want to 
  220. experiment with more layers BPS allows you to build networks with 
  221. more layers.  From figure 3 you can see that the network has three 
  222. layers, then answer "3".
  223.  
  224. Enter number of layers:  3
  225.  
  226.     Now the number of units for each layer has to be specified.  BPS will 
  227. start asking the number of units for the first layer (input layer)  up to 
  228. the layer number specified in the total number of layers (output layer).  
  229. Be careful that the number of units in the input layer and output layer 
  230. matches the dimensions of the input and output vectors specified in the 
  231. training set.
  232.  
  233. Number of nodes for layer no. 1:  2
  234. Number of nodes for layer no. 2:  1
  235. Number of nodes for layer no. 3:  1
  236.  
  237.     Since two units are needed for the first layer type "2"; for the 
  238. second layer one unit is needed, so type "1"; and for the third layer one 
  239. unit is needed; type "1".
  240.     BPS now returns to the main menu and it has given the default name 
  241. of "unnamed" to the network.  By now the network looks like this:
  242.  
  243.  
  244.  
  245.            
  246.  
  247.  
  248. Figure 4:  XOR partial network topology
  249.  
  250.  
  251. 3.2)  Specify training set (t)
  252.  
  253.     To specify or change the training set, choose "t" (for training set) 
  254. from the main menu.  BPS will ask you for the name of the file where 
  255. you wrote the training patterns.
  256.  
  257. Enter the file name of the training set:  xor.dat
  258.  
  259.  
  260. 3.3)  Edit and View menu (e)
  261.  
  262.     When you choose "e" (for edit and view) in the main menu the "edit 
  263. and view menu" appears.  In this menu you can inspect the network and 
  264. modify it.  The options on the left of the menu are to modify the 
  265. network and the options on the right of the menu are to inspect the 
  266. network.
  267.     Choose "a" (for activities and thresholds) to see the activities and 
  268. thresholds of the units in the network.  The screen looks like this:
  269.  
  270.  
  271.         Layer    Node    Activity    Threshold
  272.  
  273.           1      1    ---->    0.000000    0.000000
  274.           1      2    ---->    0.000000    0.000000
  275.  
  276.           2      1    ---->    0.000000    0.000000
  277.  
  278.           3      1    ---->    0.000000    0.000000
  279.  
  280.     From this screen you can see that the first layer has two units (1,2), 
  281. the second layer has one unit, and the third layer has one unit.  Since 
  282. this network was just defined, the activities and thresholds of the 
  283. units are all zeros.
  284.     Now choose "w" to inspect the weights in the edges; this is one of 
  285. the most used options in BPS.  The screen will look like this:
  286.  
  287.  
  288.         Layer    Node    Weight    Node    Layer
  289.  
  290.           1      1    -0.20023      1      2
  291.           1      2     0.23874      1      2
  292.  
  293.           2      1     0.18973      1      3
  294.  
  295.     The layers and units on the left are the source units, and the layers 
  296. and nodes on the right are the target units.  From this screen you can 
  297. see the weights between two units.
  298.     The XOR network needs two more edges, so choose "e" (for edge) to 
  299. add a new edge.  Edges in the network have direction; that is they come 
  300. out of one unit and they go into another unit; to add an edge you have to 
  301. specify the source unit and the target unit.  Since BPS handles 
  302. multilayer networks, each unit location is defined by the number of the 
  303. layer where the unit is and the unit's number in that layer; see figure 3 
  304. for layer and unit numbers.  The following entries are to add an edge 
  305. from the first unit in the first layer to the first unit in the third layer:
  306.  
  307. Layer number of source unit:  1
  308. Number of source unit:           1
  309.  
  310. Layer number of target unit:  3
  311. Number of target unit:           1
  312.  
  313. Do you want a random weight? (y/n):  y
  314. Change random weight range?  (y/n):  n
  315.  
  316.  
  317. The given weight was:  -0.15652
  318.  
  319.     As you can see, BPS will ask you if you want a random weight; if you 
  320. answer "n" BPS will ask you for a specific weight that you want to give 
  321. to that edge.  If you decide to add a random weight, you can change the 
  322. range for the new weight.
  323.     Now that a new edge has been added, you can, if you want, check it 
  324. by choosing "w" (for weights) and see if the new edge is really there.
  325.     To add the second edge from the second unit in the first layer to the 
  326. first unit in the third layer choose "e" again; and respond to the 
  327. prompts, but this time the unit number of the source unit is 2.  After 
  328. you have done this you can check the network by choosing "w" again.  At 
  329. this point the network topology should look like figure 3 above.
  330.     The remaining options in the edit and view menu work similarly.  
  331. When modifying the network BPS will ask you about the location of the 
  332. node(s) involved, information that you can get from a diagram of the 
  333. network that you are building, like figure 3.  The "t" (for training set) 
  334. choice is to see the training set that you specified without having to 
  335. leave BPS.  
  336.     Now you can leave this menu by choosing "q"; this will put you back 
  337. in the main menu.
  338.  
  339.  
  340.  
  341. 3.4)  Save network (s)
  342.  
  343.     At this point that the network is complete and you may want to save 
  344. it.  When a network is saved a name is given to the network; also, all 
  345. the parameters that the network has at that time are saved, including 
  346. the number of epochs that it has been trained.  In this way, when a 
  347. network is loaded, all the parameters are loaded into BPS at the same 
  348. time.
  349.  
  350. Name for file to save network:  xor211.net
  351.  
  352.     The user can give any name to the network; XOR211.NET describes 
  353. the network as with two input units, one hidden unit, and one output 
  354. unit.
  355.  
  356.  
  357. 3.5)  Find error (f)
  358.  
  359.     If you want to know what is the current value of the network error 
  360. function, choose "f" (for find error) from the main menu.  The new error 
  361. will be displayed in the main menu where it says "error."  If you do not 
  362. choose "f" and keep training the network, the error displayed in the 
  363. main menu is not the present error, but it is the error when you 
  364. requested it the last time; this operation was designed to be user 
  365. activated.
  366.     Initially the error will be zero, but this does not means that the 
  367. error of the network is zero; this is just an initialization.
  368.  
  369.  
  370. 3.6)  Number of epochs (n)
  371.  
  372.     This number has two different purposes, depending on which learning 
  373. mode you choose to train the network.  One of these modes is to let the 
  374. learning algorithm to cycle until a specified error is reached; see next 
  375. section for the other mode.  "Cycle until converges" means that the 
  376. network will be train until an user specified error is reached.  In case 
  377. that the user specified error can not be reached, BPS will exhaust the 
  378. number of epochs specified when "n" was chosen.  In other words, the 
  379. network will be train until either it reaches an error or it uses all the 
  380. specified epochs.
  381.     When you choose "n", BPS will ask you for the number of epochs to 
  382. train the network.
  383.  
  384. Enter the number of epochs to train the network:  1000
  385.  
  386.     With what we have specified up to now we could attempt to train 
  387. this network, but let's see the other options first.
  388.  
  389.  
  390. 3.7)  Cycle until converges (c)
  391.  
  392.     When "c" is choose, you can turn the "cycle until converges" mode ON 
  393. or OFF.  If you turn it ON, then BPS will ask you for the target error; if 
  394. you turn it OFF, BPS will return to the main menu.
  395.     The other mode of learning is active when "cycle until converges" is 
  396. OFF.  It will train the network for the specified number of epochs, 
  397. without paying attention to the error of the network.
  398.     For the XOR example leave "cycle until converges" OFF; so by now you 
  399. do not need to choose "c".
  400.  
  401.  
  402. 3.8)  Adjust learning parameters (a)
  403.  
  404.     This is the fun part of BPS, adjusting the learning parameters and 
  405. see with which set of parameters the network learns faster, or if it 
  406. learns at all.  The back propagation algorithm uses two parameters to 
  407. adjust the weights in a network:  eta (learning rate) and alpha 
  408. (momentum factor); see section 4.  BPS has a speed up mechanism that 
  409. adjusts these two parameters after each epoch; this mechanism 
  410. introduces two new variables:  an upper bound for eta and an increasing 
  411. rate for eta (see section 4).
  412.     These four variables can be set by the user.  They default to 
  413. conservative values, so most networks will slowly learn the patterns.  
  414. For some topologies a larger bound for eta, 1.0, will allow the network 
  415. to learn faster; instead for other topologies, a large eat would lead 
  416. them to instability and their weights will become very large.  By 
  417. experience it has been found that if a network's weights after a few 
  418. thousand epochs have become large (above 10) and the error is still 
  419. large, probably that network will not learn the mapping.  However, if 
  420. after a few thousand epochs the network has not learn the mapping but 
  421. its weights are still small (below 2), there is still a chance for the 
  422. network to learn the mapping.
  423.     It is good practice to save a network as soon as you define it.  In 
  424. this way, if the network does not learn with a set of learning 
  425. parameters, you can load the original network and try another set of 
  426. learning parameters; this allows you to start from the same initial 
  427. state.  If the network still does not learn, them you can try another 
  428. initial state (another set of random weights) by creating a new 
  429. network.  And if the network still does not learn, then you can try 
  430. another topology:  add units or edges.
  431.     As you can see, there is some testing to be done with these 
  432. networks; but the more experiments that you do, the more familiar you 
  433. will become with their behavior.
  434.     When you choose "a" (for adjust learning parameters), you can change 
  435. the values of these four variables:  eta, alpha, bound of eta, and 
  436. increasing rate of eta.  For the XOR problem the default values will be 
  437. used; so once again, you do not need to choose "a".
  438.  
  439.  
  440. 3.9)  Production menu (p)
  441.  
  442.     Before training the network let's see what kind of output it is 
  443. producing.  To do this choose "p" (for production menu) from the main 
  444. menu.  In the production menu you can do productions (propagate input 
  445. vectors through the network to obtain output vectors) from a file or 
  446. from the keyboard.  You can also save those productions in a file.  All 
  447. these possibilities are shown in this menu.
  448.     To do productions from the keyboard choose "k"; BPS will give you 
  449. the number of input units (dimension of input vector) and ask you for 
  450. the input vector:
  451.  
  452. Input vector:  0.0 0.0
  453.  
  454. Output vector:  0.52343
  455.  
  456.     The terms of the input vector need to have a space in between, you 
  457. can also hit return and give more terms in the next line.  The output at 
  458. this time will be around 0.5 because the network has not been trained 
  459. yet.  Try other input vectors and you will see that all of the output 
  460. vectors are around 0.5.
  461.     Sometimes you want to give a large set of productions to the 
  462. network; that is why the production file was created, because you will 
  463. get tired of typing input vectors.  So you can specify a production file 
  464. where you have the set of productions that you want to do.  To set the 
  465. production file choose "p" and BPS will ask you:
  466.  
  467. Enter file name:  xor.pro
  468.  
  469.     BPS will remember this file, so you do not have to specify it every 
  470. time that you enter the production menu.  Sometimes you may want to 
  471. have several productions file for the same network; to change the 
  472. production file just choose "p" again and give the name of the new file.  
  473. The "v" (for view) option is to view the production file, to check if it is 
  474. the right set of productions that you want to test.
  475.     After you have specified a production file you can choose "f" (for 
  476. productions from file) and get many productions at once.
  477.     Suppose that you want to save productions when you do them either 
  478. from a file or from the keyboard.  You can tell BPS to open a file to 
  479. write the productions.  To do this choose "s" (for save); this choice is 
  480. used to open and close a file.  If you want to open a file respond "y" and 
  481. BPS will ask you:
  482.  
  483. Save productions in a file? (y/n):  y
  484.  
  485. Enter file name to save productions:  xor.out
  486.  
  487.     If you respond "n" and a saving file was open, BPS will close the file.  
  488. However, you do not need to close this file specifically; if you leave the 
  489. production menu and a saving file was open, BPS will close it for you.
  490.     Now you know everything about the production menu, so you can 
  491. choose "q" to return to the main menu.
  492.  
  493.  
  494. 3.10)  Learn (l)
  495.  
  496.     Finally the network is ready to start the training.  For this choose "l" 
  497. (for learning) and depending on the state of the "cycle until converges" 
  498. switch (see section 3.6), the learning will be in either of the two 
  499. modes.  Since we left this switch in OFF for this example, the learning 
  500. will exhaust the specified number of epochs; the display while the 
  501. network is being trained will look like this:
  502.  
  503.         20    eta:  0.06    error:  0.32012345
  504.         40    eta:  0.10    error:  0.32012201
  505.         60    eta:  0.45    error:  0.31999982
  506.         80    eta:  0.60    error:  0.31999873
  507.          .      .      .
  508.          .      .      .
  509.  
  510.     From this display you can see how the epoch number increases, how 
  511. eta changes and (hopefully) how the error decreases.
  512.     Probably for the first 1000 epochs the error will stay around 0.32, 
  513. and may be up to 3000 epochs.  But when the error starts decreasing it 
  514. goes very fast.  If the learning rate is high (around 0.95), the error will 
  515. decrease up to a point and then stay there; if the learning rate is too 
  516. high (above 1.0), the error will decrease rapidly up to a point and then 
  517. it will start increasing.  You may even get a running time error, 
  518. "floating point excepting"; this is because the weights became 
  519. extremely large.  You can train the network for a while and then go to 
  520. the "edit and view" menu to see how the weights have changed.  Try 
  521. training the same initial network with several learning parameters and 
  522. see what kind of results you obtain.
  523.     These exercises will help you to get an idea of how the back 
  524. propagation algorithm works so you can do bigger applications 
  525. afterwards.
  526.  
  527.  
  528. 3.11)  Transfer function options menu (m)
  529.  
  530.     You enter this menu by choosing "m" from the main menu.  This menu 
  531. has two options:  to change the amplitude of the sigmoid function (M) 
  532. and to shift the sigmoid function downward so it is symmetrical around 
  533. the x-axis.
  534.  
  535.  
  536.                                                       
  537.  
  538.     Figure 5:  Sigmoid function with range 0.0, M and -M/2, M/2
  539.  
  540.     By default the range of the sigmoid function is between 0.0 and 1.0.  
  541. When you select "m" in this menu BPS will ask you for the new upper 
  542. limit of the sigmoid function:
  543.  
  544. Enter new value:  2.0
  545.  
  546.     Now the range of the sigmoid function is [0.0,2.0] instead of being in 
  547. the range [0.0,1.0].  Note that to be able to train a network with this 
  548. new amplitude, you have to define the training patterns to be in this 
  549. range also.
  550.     The other option is to make the sigmoid function symmetrical with 
  551. respect to the x-axis; this option can be switched ON and OFF by 
  552. choosing "s" in this menu.  Note that the range of the sigmoid function 
  553. will be between -M/2 and M/2.  For example, if you specify M = 2.0, then 
  554. the range of the sigmoid function would be -1.0 and 1.0.
  555.  
  556.  
  557. 4)  Formulas
  558.  
  559.     To give you more insight into what BPS is doing while a network is 
  560. being trained, this section describes some of the main formulas of the 
  561. learning algorithm.
  562.     In these formulas p stands for training patterns.  Then the 
  563. summation over p means one epoch; all the training patterns have to go 
  564. through.  Symbols for the units are j, i, and k.  The j is for the unit 
  565. which parameters are being calculated; the i is for units in the 
  566. previous layer, and the k is for units in the next layer.
  567.  
  568.  
  569.  
  570.  
  571.  
  572.            
  573.  
  574. Figure 6: units and subscripts  
  575.  
  576.     
  577.  
  578. Weight adjustment:
  579.  
  580.         ╞Wji(t+1) = h ╖p (dpj Opi)  +  a ╞Wji(t)        (1)    
  581.  
  582.     where
  583.         dpj = (Tpj - Opj) (Opj/M) (1 - Opj/M)        for output units.
  584.         dpj = (Opj/M) (1 - Opj/M) ╖k (dpk Wkj)    for hidden units.
  585.  
  586.         O :  unit activity level.
  587.         T :  output unit target.
  588.         M :  sigmoid function amplitude.
  589.  
  590.     A difference between formula 1 and the original back propagation 
  591. formula is the summation of the products of the deltas and previous 
  592. unit activation over all the training patterns, p.  By doing this operation 
  593. the weights will be updated only once per epoch of training.  This is the 
  594. first part of a two parts method proposed by Vogl to accelerate 
  595. learning by back propagation.
  596.  
  597.     Transfer function:
  598.  
  599.                             1
  600.         Opj =  M (  ------------------------   -  1/2 )
  601.                      - ( ╖i Wji Opi + qj) / M
  602.              1  + e
  603.  
  604.  
  605.     Error function:
  606.  
  607.         error =  ╖p [1/2 ╖j (Tpj - Opj)**2 ]
  608.  
  609.  
  610.     Eta and alpha adjustment:
  611.  
  612.         C (t) = << ╞Wji(t-1) , ╞Wji(t) >>    Correlation.
  613.  
  614.         if ( C(t) < 0 ) then
  615.             h --> 0.01
  616.             a --> 0.00
  617.         else
  618.             if (C(t) < (C(t-1) + 0.05 * C(t-1))  or  h < eta bound) then
  619.                 h --> h + eta rate
  620.                 a --> a + 0.01
  621.             endif
  622.         endif
  623.  
  624.  
  625.     The correlation gives an indication of how the weights are changing.  
  626. If this term becomes negative, then eta and alpha are decreased 
  627. drastically to 0.01 and 0.0 respectively.  If the correlation is positive, 
  628. then eta and alpha have passed the first test to be increased.  The 
  629. second test to increase eta and alpha is that if eta is below its 
  630. maximum allowed value (its bound) and if the correlation is within the 
  631. last correlation plus five percent.
  632.     The original correlation test was implemented by David Schreibman 
  633. and consisted in checking if C(t) was either positive of negative; if it 
  634. was negative then the values of eta and alpha were dropped to low 
  635. values, and if it was positive eta and delta were increased.  The 
  636. additional test of checking if the correlation is increasing or 
  637. decreasing was added to give more stability to the learning.
  638.